Hashed-keyMessageAuthenticationCodes(HMACs)HMACwasdevisedbyHugoKrawczykTheHMACmechanismisdescribedinRFC2104:Krawczyk,H.,Bellare,M.,andR.Canetti,"HMAC:Keyed-HashingforMessageAuthentication",RFC2104,February1997.AHash-basedMessageAuthenticationCodecanbeusedtodetermineifmessagessentoverinsecurechannelshavebeenmodified.Thisworksbyeachpartyatbothsendssharingasecretkeyusedtosignthesentmessageandtoalsoauthenticatethereceivedmessage.Ifthekeyiscompromised(nolongersecret)thentheauthenticationcannotbeguaranteed.HMACisusedformessageintegritychecksbetweentwopartiesthatshareasecretkey,andworksincombinationwithaSHA-2messagedigestalgorithm.HMACisamethodforcomputingakeyedMACusingaSHA-2hashfunction.Itusesakeytomixinwiththeinputdatatoproducethefinalmessagedigest.ThisclassmakesveryfastopensourcecodeperformingthethreemostusedSHA-2hashfunctions(256-384-512)availabletoanyOSon32-bitx86withrudimentarymmx.SinceSHA-2isdefinedintermsofanarbitrarynumberofbits,thisHMACcodehasbeenwrittentoallowthemessageinputtoHMACtohaveanarbitrarynumberofoctetsandbits.MoreinformationaboutHMACcanbefoundat:https://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf======================================================================================================================================================NowincludesoptionforFinalizetoalsoreturnthemessagebitlength.